package com.geek.domain;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;


public class AnnotationReflectDomain extends ArrayList<Integer> {

    public static void main(String[] args) {
        Type type = AnnotationReflectDomain.class.getGenericSuperclass();
        System.out.println("type.getClass() = " + type.getClass());

        if (type instanceof ParameterizedType) {
            ParameterizedType parameterizedType = (ParameterizedType) type;
            if (parameterizedType.getRawType() instanceof Class) {
                // 获取了这里的泛型 extends ArrayList<Integer>
                // java.util.ArrayList<java.lang.Integer>
                Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
                Type type1 = actualTypeArguments[0];
                if (type1 instanceof Class) {
                    Class type11 = (Class) type1;
                    System.out.println("type11 = " + type11);
                }

            }
        }
    }

}
